<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UpdateVisibilityColumn extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		// 数据库里面有一个列的名字错了
		Schema::table('articles', function(Blueprint $table) {
			$table->tinyInteger('visibility')->nullable()->default(1); 	// 1所有人 2关注我的人 3我关注的人
		});

		DB::update("
		    UPDATE articles set visibility=Visiblity
		");

   		Schema::table('articles',function(Blueprint $table){
  			$table->dropColumn('Visiblity');
  		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
	}

}
